package com.videoaggre.zcl.ui.activity

import com.videoaggre.zcl.R
import com.videoaggre.zcl.helper.RefreshHelper
import com.videoaggre.zcl.ui.adapter.BaseRecyclerAdapter
import kotlinx.android.synthetic.main.activity_base_refresh.*

/**
 * 在initview中初始化适配器
 */
abstract class BaseRefreshActivity<T>(layoutResID: Int? = null) : BaseActivity(layoutResID ?: R.layout.activity_base_refresh) {
    protected lateinit var mRefreshHelper: RefreshHelper<T, MutableList<T>>
    protected lateinit var mBaseRecyclerAdapter: BaseRecyclerAdapter<*, T>
    override fun initView() {
        mRefreshHelper = RefreshHelper(refreshLayout, recyclerView, mBaseRecyclerAdapter = mBaseRecyclerAdapter) { onReload() }
    }

    override fun initData() {
        onReload()
    }

    abstract fun onReload()
}